<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->id();
            $table->integer("user_id")->comment("创建者");
            $table->integer("category_id")->comment("分类");
            $table->String("description")->comment("描述");
            $table->decimal("price", 10, 2)->comment("价格");
            $table->integer("stock")->comment("库存");
            $table->string("cover")->comment("封面图");
            $table->json('pics')->comment("小图集");
            $table->tinyInteger('is_on')->default(0)->comment("是否上架 0:不上 1:上架");
            $table->tinyInteger('is_recommend')->default(0)->comment("是否推荐 0:未推荐 1:已推荐");
            $table->text("detail")->comment("商品详情");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('goods');
    }
};
